Möbius Inversion

Introduction

Sums Over Divisors: The Basic Landscape

The Möbius Function $\mu(n)$: Definition and First Properties

Understanding Multiplicative Functions Through Examples

Dirichlet Convolution: A Natural Way to Combine Arithmetic Functions

This last identity is the heart of Möbius inversion.

The Möbius Inversion Formula: Statement and Intuition

Statement

If $$g(n) = \sum_{d\mid n} f(d),$$ then $$f(n) = \sum_{d\mid n} \mu(d)\, g(n/d).$$

Intuition

Why Möbius Inversion Works: A Gentle Proof

Common Patterns: When to Use Möbius Inversion

Use Möbius inversion when:

Classic Applications

Counting Squarefree Numbers

Recovering a Function from Its Divisor Sum

The Euler Totient Function Revisited

Advanced but Accessible Examples

Inverting Summatory Functions

Detecting Coprimality

Connections to Generating Functions and Dirichlet Series

Summary and Key Takeaways

Exercises

Try these to solidify your understanding:

  1. Compute $\mu(n)$ for the following values:
    • $n=1, 8, 10, 18, 30, 45$.

    Solution

    Task: Compute $\mu(n)$ for $n=1, 8, 10, 18, 30, 45$.

    • Recall:
      • $\mu(1)=1$
      • $\mu(n)=0$ if $n$ has a squared prime factor
      • $\mu(n)=(-1)^k$ if $n$ is a product of $k$ distinct primes
    • $n=1$
      • By definition, $\mu(1)=1$.
    • $n=8$
      • $8=2^3$ has a repeated prime factor ($2^2$ divides $8$).
      • So $\mu(8)=0$.
    • $n=10$
      • $10=2\cdot 5$ (two distinct primes).
      • So $\mu(10)=(-1)^2=1$.
    • $n=18$
      • $18=2\cdot 3^2$ has a repeated prime factor ($3^2$).
      • So $\mu(18)=0$.
    • $n=30$
      • $30=2\cdot 3\cdot 5$ (three distinct primes).
      • So $\mu(30)=(-1)^3=-1$.
    • $n=45$
      • $45=3^2\cdot 5$ has a repeated prime factor ($3^2$).
      • So $\mu(45)=0$.
  2. Verify the identity $$\sum_{d\mid n} \mu(d) = \begin{cases} 1 & n=1,\\ 0 & n>1. \end{cases}$$ by checking it for $n=1$ through $n=12$.

    Solution

    Task: Verify $$\sum_{d\mid n} \mu(d)= \begin{cases} 1 & n=1,\\ 0 & n>1 \end{cases}$$ for $n=1,\dots,12$.

    We list divisors and sum $\mu(d)$.

    • $n=1$
      • Divisors: $1$
      • Sum: $\mu(1)=1$.
    • $n=2$
      • Divisors: $1,2$
      • $\mu(1)=1,\ \mu(2)=-1$
      • Sum: $1+(-1)=0$.
    • $n=3$
      • Divisors: $1,3$
      • $\mu(1)=1,\ \mu(3)=-1$
      • Sum: $1+(-1)=0$.
    • $n=4$
      • Divisors: $1,2,4$
      • $\mu(1)=1,\ \mu(2)=-1,\ \mu(4)=0$ (since $4=2^2$)
      • Sum: $1-1+0=0$.
    • $n=5$
      • Divisors: $1,5$
      • $\mu(1)=1,\ \mu(5)=-1$
      • Sum: $1-1=0$.
    • $n=6$
      • Divisors: $1,2,3,6$
      • $\mu(1)=1,\ \mu(2)=-1,\ \mu(3)=-1,\ \mu(6)=1$
      • Sum: $1-1-1+1=0$.
    • $n=7$
      • Divisors: $1,7$
      • $\mu(1)=1,\ \mu(7)=-1$
      • Sum: $1-1=0$.
    • $n=8$
      • Divisors: $1,2,4,8$
      • $\mu(1)=1,\ \mu(2)=-1,\ \mu(4)=0,\ \mu(8)=0$
      • Sum: $1-1+0+0=0$.
    • $n=9$
      • Divisors: $1,3,9$
      • $\mu(1)=1,\ \mu(3)=-1,\ \mu(9)=0$
      • Sum: $1-1+0=0$.
    • $n=10$
      • Divisors: $1,2,5,10$
      • $\mu(1)=1,\ \mu(2)=-1,\ \mu(5)=-1,\ \mu(10)=1$
      • Sum: $1-1-1+1=0$.
    • $n=11$
      • Divisors: $1,11$
      • $\mu(1)=1,\ \mu(11)=-1$
      • Sum: $1-1=0$.
    • $n=12$
      • Divisors: $1,2,3,4,6,12$
      • $\mu(1)=1,\ \mu(2)=-1,\ \mu(3)=-1,\ \mu(4)=0,\ \mu(6)=1,\ \mu(12)=0$
      • Sum: $1-1-1+0+1+0=0$.

    Conclusion: The identity holds for $1\le n\le 12$, and in fact for all $n$.

  3. Suppose $g(n)=\sum_{d\mid n} f(d)$ and you are told that $g(n)=n$.
    • Use Möbius inversion to find $f(n)$ explicitly.

    Solution

    Task: If $g(n)=\sum_{d\mid n} f(d)$ and $g(n)=n$, find $f(n)$.

    • We are in the standard Möbius inversion setup: $$g(n)=\sum_{d\mid n} f(d).$$
    • Möbius inversion says: $$f(n)=\sum_{d\mid n} \mu(d)\, g(n/d).$$
    • Here $g(n/d)=n/d$, so $$f(n)=\sum_{d\mid n} \mu(d)\,\frac{n}{d} = n\sum_{d\mid n} \frac{\mu(d)}{d}.$$

    This expression is already a valid closed form. But we can recognize it:

    • Compare with the known identity $$\varphi(n)=\sum_{d\mid n} \mu(d)\,\frac{n}{d}.$$
    • Therefore $$f(n)=\varphi(n).$$

    Answer: $f(n)=\varphi(n)$, Euler’s totient function.

  4. Let $h(n)=\sum_{d\mid n} d$.
    • Use Möbius inversion to express $n$ in terms of $h$ and $\mu$.

    Solution

    Task: Let $h(n)=\sum_{d\mid n} d$. Express $n$ in terms of $h$ and $\mu$.

    • We have $$h(n)=\sum_{d\mid n} d.$$
    • Notice that $h$ is the divisor sum of the function $f(d)=d$: $$h(n)=\sum_{d\mid n} f(d),\quad f(d)=d.$$
    • By Möbius inversion, $$f(n)=\sum_{d\mid n} \mu(d)\, h(n/d).$$
    • But $f(n)=n$, so $$n=\sum_{d\mid n} \mu(d)\, h(n/d).$$

    Answer: $$n=\sum_{d\mid n} \mu(d)\, h(n/d).$$

  5. Show that $$\varphi(n)=\sum_{d\mid n} \mu(d)\,(n/d).$$
    • Then compute $\varphi(12)$ using this formula.

    Solution

    Task: Show $$\varphi(n)=\sum_{d\mid n} \mu(d)\,(n/d),$$ then compute $\varphi(12)$ using this formula.

    Step 1: Derive the formula

    • We know the classical identity: $$\sum_{d\mid n} \varphi(d)=n.$$
    • This can be written as $$n = \sum_{d\mid n} \varphi(d).$$
    • Compare with the general pattern $g(n)=\sum_{d\mid n} f(d)$:
      • Here $g(n)=n$ and $f(d)=\varphi(d)$.
    • By Möbius inversion, $$\varphi(n)=\sum_{d\mid n} \mu(d)\, g(n/d) =\sum_{d\mid n} \mu(d)\,\frac{n}{d}.$$

    Step 2: Compute $\varphi(12)$

    • Divisors of $12$: $1,2,3,4,6,12$.
    • We need $\mu(d)$ and $12/d$:

      • $d=1$: $\mu(1)=1$, $12/1=12$ → contribution $1\cdot 12=12$
      • $d=2$: $\mu(2)=-1$, $12/2=6$ → contribution $-1\cdot 6=-6$
      • $d=3$: $\mu(3)=-1$, $12/3=4$ → contribution $-1\cdot 4=-4$
      • $d=4$: $\mu(4)=0$ → contribution $0$
      • $d=6$: $\mu(6)=1$, $12/6=2$ → contribution $1\cdot 2=2$
      • $d=12$: $\mu(12)=0$ → contribution $0$
    • Sum: $$\varphi(12)=12-6-4+0+2+0=4.$$

    Answer:

    • Formula: $\displaystyle \varphi(n)=\sum_{d\mid n} \mu(d)\,\frac{n}{d}$.
    • Value: $\varphi(12)=4$.
  6. (A bit more challenging) Prove that $$\sum_{d\mid \gcd(m,n)} \mu(d)$$ is $1$ if $\gcd(m,n)=1$ and $0$ otherwise.

    Solution

    Task: Prove that $$\sum_{d\mid \gcd(m,n)} \mu(d)= \begin{cases} 1 & \gcd(m,n)=1,\\ 0 & \gcd(m,n)>1. \end{cases}$$ Let $g=\gcd(m,n)$.

    • The sum is $$\sum_{d\mid g} \mu(d).$$
    • From Exercise 2 (and the general identity), we know: $$\sum_{d\mid k} \mu(d)= \begin{cases} 1 & k=1,\\ 0 & k>1. \end{cases}$$
    • Apply this with $k=g$:
      • If $g=1$ (i.e. $\gcd(m,n)=1$), the sum is $1$.
      • If $g>1$ (i.e. $\gcd(m,n)>1$), the sum is $0$.

    Answer: The sum over divisors of $\gcd(m,n)$ of $\mu(d)$ is $1$ when $m,n$ are coprime and $0$ otherwise.

  7. Let $f(n)=1$ for all $n$.
    • Compute $g(n)=\sum_{d\mid n} f(d)$
    • Then invert to recover $f(n)$ using Möbius inversion.

    Solution

    Task: Let $f(n)=1$ for all $n$. Compute $g(n)=\sum_{d\mid n} f(d)$, then invert to recover $f(n)$.

    Step 1: Compute $g(n)$

    • Since $f(d)=1$ for every $d$, $$g(n)=\sum_{d\mid n} f(d)=\sum_{d\mid n} 1.$$
    • This is just the number of divisors of $n$, usually denoted $\tau(n)$.
    • So $g(n)=\tau(n)$.

    Step 2: Invert using Möbius inversion

    • We have $$g(n)=\sum_{d\mid n} f(d),$$ with $g(n)=\tau(n)$ and $f(n)=1$.
    • Möbius inversion gives $$f(n)=\sum_{d\mid n} \mu(d)\, g(n/d) =\sum_{d\mid n} \mu(d)\,\tau(n/d).$$
    • But we know $f(n)=1$, so this identity becomes $$1=\sum_{d\mid n} \mu(d)\,\tau(n/d)$$ for every $n$.

    Answer:

    • $g(n)=\tau(n)$, the number of divisors of $n$.
    • Möbius inversion recovers $f(n)=1$ via $$1=\sum_{d\mid n} \mu(d)\,\tau(n/d).$$